package guard_grammar;

import java.util.LinkedList;

/**
 * @author Zlatka Trajcheska, Marija Petkovska
 * @version 1.0 18.02.2013 
 * 
 * This class is used as a sceleton for the rules in the grammar.
 */

public class Rule {

    int ruleID;
    LinkedList<String> ruleList;

    /**
	 * This method is the constructor of the class.
	 * 
	 * @param int id - the id of the new Rule to be created
	 * @param LinkedList<String> l - the list of terminals/nonterminals in the given order that make up the right side of the rule
	 */
    Rule (int id, LinkedList<String> l)
    {
        ruleID=id;
        ruleList= new LinkedList<String>();
        for (int i=0;i<l.size();i++)
        {
            this.ruleList.add(l.get(i));
        }
    }

    /**
	 * This method is used to access the rule id.
	 *
	 * @return int - the rule id 
	 */
    public int getRuleID()
    {
        return this.ruleID;
    }
    
    /**
	 * This method is used to access the rule list od terminals and nonterminals.
	 *
	 * @return LinkedList<String> -  the list of terminals and nonterminals 
	 */
    public LinkedList<String> getRuleList()
    {
        return this.ruleList;
    }
}